<?php

/**
 * blogs actions.
 *
 * @package    IPLIFE
 * @subpackage blogs
 * @author     alexey.shapran@gmail.com
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class blogsComponents extends sfComponents
{
	/**
	 * Executes index action
	 *
	 * @param sfRequest $request A request object
	 */
	public function executeAuthorblock(sfWebRequest $request)
	{
		
	}	
	public function executeLast5(sfWebRequest $request)
	{
		$con = Doctrine_Manager::getInstance()->connection();
		$query = " SELECT a.*, u.lastname, u.firstname, u.image FROM ( SELECT * FROM blog_post bp ORDER BY bp.updated_at DESC ) a LEFT JOIN sf_guard_user u ON a.user_id  = u.id  GROUP BY user_id ORDER BY a.updated_at DESC LIMIT 5 ";
		$st = $con->execute($query);
		$this->last5blogs = $st->fetchAll();
	}
}